package com.abl.common.mybatis.dao;


import com.abl.common.mybatis.model.Dnt;
import com.abl.common.mybatis.model.Page;
import com.abl.common.mybatis.strengthen.Wrapper;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;

/**
 * 强化操作，要么使用Ent 要么使用实体类，使用Ent就意味着需要填写表名，
 *
 * @author 王永吉
 */
public interface Dao {

    long insert(String tableName, Dnt entity);

    long insertBatch(String tableName, List<Dnt> entityList);

    long insertBatch(String tableName, List<Dnt> entityList, int batchSize);

    long delete(String tableName, Wrapper<Object> wrapper);

    long deleteById(String tableName, Serializable id);

    //    long deleteById(String tableName,String idColumn, Serializable id);
    long deleteByIds(String tableName, Collection<Serializable> ids);

    long deleteByIds(String tableName, Collection<Serializable> ids, int batchSize);

    //    long deleteByIds(String tableName,String idColumn, Collection<Serializable> ids);
//    long deleteByIds(String tableName,String idColumn, Collection<Serializable> ids,int batchSize);

    long update(String tableName, Dnt entity, Wrapper<Object> wrapper);

    long update(String tableName, Wrapper<Object> wrapper);

    long updateById(String tableName, Dnt entity);

    long updateById(String tableName, Dnt entity, String idKey);

    //    long updateById(String tableName,String idColumn,Ent entity,Serializable id);
    long updateBatchById(String tableName, List<Dnt> entityList);

    long updateBatchById(String tableName, List<Dnt> entityList, String idKey);

    long updateBatchById(String tableName, List<Dnt> entityList, int batchSize);

    long updateBatchById(String tableName, List<Dnt> entityList, String idKey, int batchSize);
//    long updateBatchById(String tableName,String idColumn,List<Ent> entityList);
//    long updateBatchById(String tableName,String idColumn,List<Ent> entityList, int batchSize);


    Dnt selectOne(String tableName, Wrapper<Object> wrapper);

    Dnt selectOneOrigin(String selectSqlStr, Wrapper<Object> wrapper);

    Dnt selectOne(Wrapper<Object> wrapper);

    Object selectObj(String tableName, Wrapper<Object> wrapper);

    Object selectObjOrigin(String selectSqlStr, Wrapper<Object> wrapper);

    List<Dnt> listOrigin(String selectSqlStr, Wrapper<Object> wrapper);

    List<Dnt> listOrigin(Wrapper<Object> wrapper);

    List<Dnt> list(String tableName, Wrapper<Object> wrapper);

    List<Dnt> list(Wrapper<Object> wrapper);

    List<Object> listObj(String tableName, Wrapper<Object> wrapper);

    List<Object> listObj(Wrapper<Object> wrapper);

    <T> List<T> listObj(String tableName, Wrapper<Object> wrapper, Class<T> t);

    long count(String tableName, Wrapper<Object> wrapper);

    Page<Dnt> page(String tableName, int current, int size);

    Page<Dnt> page(Wrapper<Object> wrapper, int current, int size);

    Page<Dnt> page(String tableName, Wrapper<Object> wrapper, int current, int size);

    Page<Dnt> pageOrigin(String selectSqlStr, Wrapper<Object> wrapper, int current, int size);
}
